home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
program
/
xmsbcp11.zip
/
XMS.DOC
< prev
next >
Wrap
Text File
|
1997-04-13
|
8KB
|
207 lines
XMSBCP
XMS Interface for Borland C/C++ and Borland Pascal
Version 1.1
Developed by Tanescu A. Horatiu
April 1997
You can freely distribute this library, as long as it is free of
charge and it contains all the files listed in the file FILES.LST,
intact and unmodified. This library may be used for any purpose (even
included into commercial products), provided that the developer gives
credit to the original author.
Feel free to suggest enhancements, find bugs and report them to me.
If you use the library, please let me know, so I can find out if this
library is useful.
DISCLAIMER
All software and documentation associated with the XMSBCP library is
provided "as is": ie., it is provided without warranty of any kind, not
even an implied warranty of merchantability or fitness for any purpose.
I will in no way be held liable for any loss of profit or any other
commercial damage including but not limited to special, incidental,
consequential or other damages from use of this software.
I. Introduction
---------------
Why did I write XMSBCP ?
========================
This library was born when I had to write a program that required a huge
amount of memory, more than 1 MB. I decided to use extended memory so I
looked for an interface to allow me to access XMS from C. I was not very
satisfied with what I found (some libraries didn't have all the routines
I needed, or they didn't include their full source, or they were very slow
or difficult to use). Then I found the Lotus Intel Microsoft XMS
specification version 3.0 and after I learned how XMS works I was able to
write my own routines to access XMS. I grouped them in a library. I also
wrote a Turbo Pascal unit.
What is XMSBCP ?
================
XMSBCP provides a natural and easy-to-use interface to XMS for programs
compiled using Borland C/C++ and Borland Pascal. XMS (eXtended Memory
Specification) allows DOS programs to utilize additional memory outside
the conventional 640K imposed by DOS. XMS provides access to
1. Upper Memory Blocks (UMBs) (memory between 640K and 1024K)
2. High Memory Area (HMA) (memory between 1024K and 1088K)
3. Extended Memory Blocks (EMBs) (memory above 1088K)
XMSBCP currently implements all the XMS 3.0 API Functions (HMA Management
Functions, A20 Management Functions, Extended Memory Management Functions
and Upper Memory Management Functions). The additional C/C++ and Pascal
library XMSSUPER, that will be included in this package in the next release
will also implement the Super Extended Memory Support found in XMS 3.0 that
provides support for extended memory pools up to 4 Gb in size.
XMSBCP is written using the Borland C and Borland Pascal built-in assembler
for speed and small size.
Full source code (in C/C++ and Pascal) is included.
What is supported ?
===================
XMSBCP expressly supports the Microsoft eXtended Memory Specification (XMS)
versions 2.0 and 3.0. Versions below 2.0 are not supported. Versions above
3.0 are supported as 3.0. The only function supported only by XMS 3.0 or
above is umbrealloc/UMBReAlloc.
The C/C++ version of XMSBCP supports all memory models (tiny, small,
medium, compact, large and huge). Libraries compiled with Borland C/C++ 3.1
are provided for all memory models. The C/C++ version has been tested with
Borland C++ 3.1 in both C and C++ modes. If you recompile and test the
library with other compilers and it works, please let me know.
The Pascal version of XMSBCP supports Turbo and Borland Pascal 7.0.
What's new in version 1.1 ?
===========================
The C/C++ version of XMSBCP now supports all memory models (libraries
compiled with Borland C/C++ 3.1 are provided).
Some changes and improvements were made to the C/C++ version: the memory
copy routines (ctoxm, xmtoc, xmtoxm, ctoc) are now implemented as macros
(in C) / inline functions (in C++) to increase speed; the xmsinstalled
variable was defined to test if an XMS driver is installed without having
to recall xmsinit; a bug was fixed in MDCOPY (the library test program).
Minor changes and improvements were made to the Pascal version too.
The documentation has been rewritten and improved.
II. Compiling and linking with XMSBCP
-------------------------------------
To use XMSBCP into a C/C++ program, include the header file XMS.H and
link the program with the library corresponding to the memory model in
which you have compiled the program.
To use XMSBCP into a Pascal program just add XMS in the uses clause.
III. Programming with XMSBCP
----------------------------
The library initialization function initxms() (InitXMS in Pascal version)
must be called before any other XMSBCP routines. All other XMSBCP functions
will fail if called before the initialization function.
> For the C/C++ version
Initxms() is automatically called when you include xms.h (a "#pragma
startup initxms" directive is placed in xms.h).
> For the Pascal version
InitXMS is automatically called when you use xms.tpu (XMSInit is called in
the initialization part of the xms unit).
After calling the initialization function you can
- get the XMS driver version (xmsver/XMSVersion, xmsverinfo/XMSVersionInfo)
- allocate the High Memory Area (HMA) (hmarequest/HMARequest)
- release the HMA (hmarelease/HMARelease)
- get the amount of free extended memory (xmfreespace/XMFreeSpace)
- get the size of the largest free extended memory block (xmcontig/XMContig)
- allocate extended memory blocks (EMBs) (xmalloc/XMAlloc)
- resize EMBs (xmrealloc/XMRealloc)
- free EMBs (xmfree/XMFree)
- lock EMBs (xmlock/XMLock)
- unlock EMBs (xmunlock/XMUnlock)
- transfer data from conventional to extended memory (ctoxm/CopyCMemToXMem)
- transfer data from extended to conventional memory (xmtoc/CopyXMemToCMem)
- transfer data within extended memory (xmtoxm/CopyXMem)
- transfer data within conventional memory (ctoc/CopyMem)
- allocate upper memory blocks (UMBs) (umballoc/UMBAlloc)
- resize UMBs (umbrealloc/UMBReAlloc)
- free UMBs (umbfree/UMBFree)
- return an adequate description of the last XMS error that occured
(xmserrormsg/XMSErrorMsg)
, etc.
Many functions return 1 on success and 0 on failure (in this case an error
code is returned in xmserrno (C) or in XMSError (PASCAL) ).
A short description of all XMSBCP constants/types/variables/functions can
be found in the DESCRIP.TXT file.
IV. Release Information
-----------------------
Version 1.1
+ Support for all memory models (C/C++).
+ Included compiled libraries for all memory models (C/C++).
+ Rewritten and improved documentation.
+ Changed name to reflect version information.
+ Miscellaneous changes and improvements (C/C++ and Pascal).
Version 1.0
First official release.
V. Plans for future releases
----------------------------
+ The additional XMSSUPER C/C++ and Pascal library that will implement
the Super Extended Memory Support found in XMS 3.0.
+ An Object-Oriented Interface for Extended Memory Blocks, Upper Memory
Blocks, High Memory Area, XMS Errors, both in C++ and Pascal.
The more feedback I get the more likely I am to achieve these goals or
to continue writing programming libraries.
If you are interested in computer programming (as I am), please contact
me (my favourite subjects are OOP, C/C++, assembler, text user interfaces,
etc.).
───────────────────────────────────────────────────────────────────────────
Tanescu A. Horatiu (alpha@lego.soroscj.ro)
"Emanuil Gojdu" High School Oradea Romania
───────────────────────────────────────────────────────────────────────────